home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 22 / macformat_22.iso / Shareware / Programación / The Gray Council 1.1 / projects / PowerPlant / MyApplication.cp < prev    next >
Encoding:
Text File  |  1996-08-08  |  18.5 KB  |  648 lines  |  [TEXT/CWIE]

  1. //
  2. // GrayCouncil
  3. // Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
  4. //
  5. // This file contains the GrayCouncil PowerPlant test program's
  6. // application class implementation.
  7. //
  8.  
  9. #include "MyApplication.h"
  10.  
  11. #include <LGrowZone.h>
  12. #include <LWindow.h>
  13. #include <PP_Messages.h>
  14. #include <PP_Resources.h>
  15. #include <PPobClasses.h>
  16. #include <UDrawingState.h>
  17. #include <UMemoryMgr.h>
  18. #include <URegistrar.h>
  19. #include <LEditField.h>
  20. #include <LGroupBox.h>
  21. #include <UModalDialogs.h>
  22.  
  23. #include "MyConstants.h"
  24.  
  25. void main(void)
  26.     {
  27.     //
  28.     // Initialize PowerPlant.
  29.     //
  30.  
  31.     SetDebugThrow_(debugAction_Alert);
  32.     SetDebugSignal_(debugAction_Alert);
  33.  
  34.     InitializeHeap(3);
  35.  
  36.     UQDGlobals::InitializeToolbox(&qd);
  37.     
  38.     new LGrowZone(20000);
  39.  
  40.     //
  41.     // Initialize The Gray Council.
  42.     //
  43.  
  44.     (void) InitGrayCouncilPP();
  45.  
  46.     //
  47.     // Run our app.
  48.     //
  49.  
  50.     MyApplication    myApp;
  51.     myApp.Run();
  52.     }
  53.  
  54. #undef Inherited
  55. #define Inherited LApplication
  56.  
  57. MyApplication::MyApplication()
  58.     {
  59.     RegisterAllPPClasses();
  60.  
  61.     // Init the pointers & stuff used during idling.
  62.     mProgressIndicator1 = NULL;
  63.     mProgressIndicator2 = NULL;
  64.     mMovingProgressOrigin = FALSE;
  65.     mSkipNext = FALSE;
  66.     
  67.     this->StartRepeating();    // make LPeriodical start idling
  68.     }
  69.  
  70. MyApplication::~MyApplication()
  71.     {
  72.     }
  73.  
  74. void MyApplication::StartUp()
  75.     {
  76.     //
  77.     // Create and open our main window.
  78.     //
  79.  
  80.     LWindow        *theWindow;
  81.     theWindow = LWindow::CreateWindow(kMainWindowViewID, this);    
  82.     theWindow->Show();
  83.     
  84.     //
  85.     // Set up to catch button clicks in our main window.
  86.     //
  87.  
  88.     for (UInt32 i = 0; i < kNumDialogs; i++)
  89.         {
  90.         LControl*    aButton = (LControl*) theWindow->FindPaneByID(kMyCommandBase + i);
  91.         if (aButton != NULL)    // not all of our commands have a button!
  92.             aButton->AddListener(this);
  93.         }
  94.     }
  95.  
  96. Boolean MyApplication::ObeyCommand(CommandT inCommand, void *ioParam)
  97.     {
  98.     Boolean    cmdHandled = TRUE;
  99.     
  100.     if ((inCommand >= kMyCommandBase) && (inCommand < kMyCommandBase + kNumDialogs))
  101.         {
  102.         // Got a menu command for one of our dialogs. Run the
  103.         // corresponding dialog.
  104.  
  105.         this->PoseExampleDialog(inCommand - kMyCommandBase);
  106.         }
  107.     else if (inCommand == cmd_About)
  108.         {
  109.         // Run the about box.
  110.  
  111.         StDialogHandler    aDlgHandler(kAboutBoxViewID, this);
  112.         LWindow*        aDialog = aDlgHandler.GetDialog();
  113.         MessageT        hitMessage;
  114.         
  115.         aDialog->Show();
  116.         
  117.         do
  118.             {
  119.  
  120.             hitMessage = aDlgHandler.DoDialog();
  121.  
  122.             } while ((hitMessage != msg_OK) && (hitMessage != msg_Cancel));
  123.         }
  124.     else
  125.         cmdHandled = Inherited::ObeyCommand(inCommand, ioParam);
  126.     
  127.     return cmdHandled;
  128.     }
  129.  
  130. void MyApplication::FindCommandStatus(CommandT inCommand, Boolean& outEnabled, Boolean& outUsesMark, Char16& outMark, Str255 outName)
  131.     {
  132.     // Enable our menu commands.
  133.  
  134.     if ((inCommand >= kMyCommandBase) && (inCommand < kMyCommandBase + kNumDialogs))
  135.         outEnabled = TRUE;
  136.     else
  137.         Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName);
  138.     }
  139.  
  140. static SInt32 MaxSInt32(SInt32 a, SInt32 b) { return (a > b) ? a : b; }
  141.  
  142. void MyApplication::ListenToMessage(MessageT inMessage, void *ioParam)
  143.     {
  144.     if ((inMessage >= kMyCommandBase) && (inMessage < kMyCommandBase + kNumDialogs))
  145.         {
  146.         // Got a button click in our main window. Run the
  147.         // corresponding dialog.
  148.  
  149.         this->PoseExampleDialog(inMessage - kMyCommandBase);
  150.         }
  151.     else switch (inMessage)
  152.         {
  153.         case 'ENAB':
  154.             this->EnableDisableDialog(mCurrentDialogIndex, mCurrentDialog, *((SInt32*) ioParam) != 0);
  155.             break;
  156.         
  157.         case 'SBAR':
  158.             {
  159.             SInt32    newScrollValue = *((SInt32*) ioParam);
  160.             LPane*    valueTextPane = mCurrentDialog->FindPaneByID('SBTX');
  161.             
  162.             valueTextPane->SetValue(newScrollValue);
  163.             valueTextPane->Draw(NULL);
  164.             }
  165.             break;
  166.         
  167.         case 'LIVE':
  168.         case 'PROP':
  169.             {
  170.             AGAScrollBarPP*    aScrollBar;
  171.             LStdCheckBox*    liveCheckBox = (LStdCheckBox*) mCurrentDialog->FindPaneByID('LIVE');
  172.             LStdCheckBox*    propCheckBox = (LStdCheckBox*) mCurrentDialog->FindPaneByID('PROP');
  173.             Boolean            live = (liveCheckBox->GetValue() != 0);
  174.             Boolean            proportional = (propCheckBox->GetValue() != 0);
  175.  
  176.             ThrowIfNil_(aScrollBar = (AGAScrollBarPP*) mCurrentDialog->FindPaneByID('SBAR'));
  177.             aScrollBar->mAGAObject->SetAttributes(AGAObject::kHorizontal, live, proportional);
  178.             if (inMessage == 'PROP')
  179.                 aScrollBar->Refresh();
  180.  
  181.             ThrowIfNil_(aScrollBar = (AGAScrollBarPP*) mCurrentDialog->FindPaneByID(PaneIDT_HorizontalScrollBar));
  182.             aScrollBar->mAGAObject->SetAttributes(AGAObject::kHorizontal, live, proportional);
  183.             if (inMessage == 'PROP')
  184.                 aScrollBar->Refresh();
  185.  
  186.             ThrowIfNil_(aScrollBar = (AGAScrollBarPP*) mCurrentDialog->FindPaneByID(PaneIDT_VerticalScrollBar));
  187.             aScrollBar->mAGAObject->SetAttributes(AGAObject::kVertical, live, proportional);
  188.             if (inMessage == 'PROP')
  189.                 aScrollBar->Refresh();
  190.             }
  191.             break;
  192.         
  193.         case 'LVSL':
  194.         case 'PRSL':
  195.             {
  196.             AGASliderPP*    aSlider;
  197.             LStdCheckBox*    liveCheckBox = (LStdCheckBox*) mCurrentDialog->FindPaneByID('LVSL');
  198.             LStdCheckBox*    propCheckBox = (LStdCheckBox*) mCurrentDialog->FindPaneByID('PRSL');
  199.             Boolean            live = (liveCheckBox->GetValue() != 0);
  200.             Boolean            proportional = (propCheckBox->GetValue() != 0);
  201.  
  202.             aSlider = (AGASliderPP*) mCurrentDialog->FindPaneByID('VSPL');
  203.             aSlider->mAGAObject->SetAttributes(AGAObject::kVertical, live, proportional);
  204.             if (inMessage == 'PRSL') aSlider->Refresh();
  205.  
  206.             aSlider = (AGASliderPP*) mCurrentDialog->FindPaneByID('VSPR');
  207.             aSlider->mAGAObject->SetAttributes(AGAObject::kVertical, live, proportional);
  208.             if (inMessage == 'PRSL') aSlider->Refresh();
  209.  
  210.             aSlider = (AGASliderPP*) mCurrentDialog->FindPaneByID('VSRC');
  211.             aSlider->mAGAObject->SetAttributes(AGAObject::kVertical, live, proportional);
  212.             if (inMessage == 'PRSL') aSlider->Refresh();
  213.  
  214.             aSlider = (AGASliderPP*) mCurrentDialog->FindPaneByID('HSPL');
  215.             aSlider->mAGAObject->SetAttributes(AGAObject::kHorizontal, live, proportional);
  216.             if (inMessage == 'PRSL') aSlider->Refresh();
  217.  
  218.             aSlider = (AGASliderPP*) mCurrentDialog->FindPaneByID('HSPR');
  219.             aSlider->mAGAObject->SetAttributes(AGAObject::kHorizontal, live, proportional);
  220.             if (inMessage == 'PRSL') aSlider->Refresh();
  221.  
  222.             aSlider = (AGASliderPP*) mCurrentDialog->FindPaneByID('HSRC');
  223.             aSlider->mAGAObject->SetAttributes(AGAObject::kHorizontal, live, proportional);
  224.             if (inMessage == 'PRSL') aSlider->Refresh();
  225.             }
  226.             break;
  227.  
  228.         case 'GO_1':
  229.             {
  230.             // Save the pointer to the indeterminate progress indicator,
  231.             // so we'll increment it at idle. Swap the enable states
  232.             // of its Go and Stop buttons.
  233.  
  234.             this->ToggleButtons('GO_1', 'STP1');
  235.             
  236.             mProgressIndicator1 = (AGAProgressIndicatorPP*) mCurrentDialog->FindPaneByID('PRG1');
  237.             }
  238.             break;
  239.         
  240.         case 'GO_2':
  241.             {
  242.             // Save the pointer to the determinate progress indicator,
  243.             // so we'll increment it at idle. Swap the enable states
  244.             // of its Go and Stop buttons.
  245.  
  246.             this->ToggleButtons('GO_2', 'STP2');
  247.             
  248.             mProgressIndicator2 = (AGAProgressIndicatorPP*) mCurrentDialog->FindPaneByID('PRG2');
  249.             }
  250.             break;
  251.         
  252.         case 'STP1':
  253.             {
  254.             // Null the pointer to the indeterminate progress indicator,
  255.             // so we'll ignore it at idle. Swap the enable states
  256.             // of its Go and Stop buttons.
  257.  
  258.             this->ToggleButtons('STP1', 'GO_1');
  259.             
  260.             mProgressIndicator1 = NULL;
  261.             }
  262.             break;
  263.         
  264.         case 'STP2':
  265.             {
  266.             // Null the pointer to the determinate progress indicator,
  267.             // so we'll ignore it at idle. Swap the enable states
  268.             // of its Go and Stop buttons.
  269.  
  270.             this->ToggleButtons('STP2', 'GO_2');
  271.             
  272.             mProgressIndicator2 = NULL;
  273.             }
  274.             break;
  275.             
  276.         case 'SETV':
  277.             {
  278.             // The "Set Values" button in the progress dialog was hit.
  279.             // Poke the determinate progress indicator with the current
  280.             // values that have been entered in the dialog.
  281.  
  282.             LEditField*        aNumberText;
  283.             LStdCheckBox*    originCheckBox = (LStdCheckBox*) mCurrentDialog->FindPaneByID('CORG');
  284.             SInt32            newMin;
  285.             SInt32            newMax;
  286.             SInt32            newValue;
  287.             SInt32            newOrigin;
  288.  
  289.             AGAProgressIndicatorPP*    indicator = (AGAProgressIndicatorPP*) mCurrentDialog->FindPaneByID('PRG2');
  290.             
  291.             aNumberText = (LEditField*) mCurrentDialog->FindPaneByID('NMIN');
  292.             newMin = aNumberText->GetValue();
  293.             
  294.             aNumberText = (LEditField*) mCurrentDialog->FindPaneByID('NMAX');
  295.             newMax = aNumberText->GetValue();
  296.             
  297.             indicator->mAGAObject->SetRange(newMin, newMax, AGAObject::kDontRedraw);
  298.             
  299.             aNumberText = (LEditField*) mCurrentDialog->FindPaneByID('NVAL');
  300.             newValue = aNumberText->GetValue();
  301.             indicator->mAGAObject->SetValue(newValue, AGAObject::kDontRedraw);
  302.             
  303.             if (originCheckBox->GetValue() == 0)
  304.                 newOrigin = newMin;
  305.             else
  306.                 {
  307.                 aNumberText = (LEditField*) mCurrentDialog->FindPaneByID('NORG');
  308.                 newOrigin = MaxSInt32(newMin, aNumberText->GetValue());
  309.                 }
  310.             
  311.             indicator->mAGAObject->SetOriginValue(newOrigin, AGAObject::kDontRedraw);
  312.             
  313.             indicator->Refresh();
  314.             }
  315.             break;
  316.             
  317.         case 'CORG':
  318.             {
  319.             // The progress dialog's "Moving Origin" checkbox was hit.
  320.             // Enable or disable the edit text and little arrows, and
  321.             // set our flag that we'll check at idle.
  322.  
  323.             LStdCheckBox*    aCheckBox = (LStdCheckBox*) mCurrentDialog->FindPaneByID('CORG');
  324.             Boolean            enabled = (aCheckBox->GetValue() != 0);
  325.             
  326.             this->EnableDisablePane('NORG', enabled);
  327.             this->EnableDisablePane('AORG', enabled);
  328.             this->EnableDisablePane('TORG', enabled);
  329.             
  330.             mMovingProgressOrigin = enabled;
  331.             }
  332.             break;
  333.  
  334.         }
  335.     }
  336.  
  337. void MyApplication::ToggleButtons(OSType buttonToDisable, OSType buttonToEnable)
  338.     {
  339.     mCurrentDialog->FindPaneByID(buttonToDisable)->Disable();
  340.     mCurrentDialog->FindPaneByID(buttonToEnable)->Enable();
  341.     }
  342.  
  343. void MyApplication::EnableDisablePane(OSType paneID, Boolean enable)
  344.     {
  345.     if (enable)
  346.         mCurrentDialog->FindPaneByID(paneID)->Enable();
  347.     else
  348.         mCurrentDialog->FindPaneByID(paneID)->Disable();
  349.     }
  350.  
  351. void MyApplication::SpendTime(const EventRecord &inMacEvent)
  352.     {
  353.     // If we have a pointer to the indeterminate progress indicator,
  354.     // it's running, so crank it once.
  355.     if (mProgressIndicator1 != NULL)
  356.         {
  357.         mProgressIndicator1->FocusDraw();
  358.         mProgressIndicator1->mAGAObject->Animate();
  359.         }
  360.  
  361.     // If we have a pointer to the determinate progress indicator,
  362.     // it's running, so increment its value.
  363.     if (mProgressIndicator2 != NULL)
  364.         {
  365.         mProgressIndicator2->FocusDraw();
  366.         mProgressIndicator2->mAGAObject->Increment(1, AGAObject::kRedraw);
  367.         
  368.         // Increment the origin every other time, if it's moving.
  369.         if (mMovingProgressOrigin && ! mSkipNext)
  370.             mProgressIndicator2->mAGAObject->SetOriginValue(1 + mProgressIndicator2->mAGAObject->GetOriginValue(), AGAObject::kRedraw);
  371.         
  372.         mSkipNext = ! mSkipNext;    // make moving origin go slower than value
  373.         }
  374.     }
  375.  
  376. void MyApplication::PoseExampleDialog(UInt32 dialogIndex)
  377.     {
  378.     // Run one of our test dialogs.
  379.  
  380.     StDialogHandler    aDlgHandler(kMyViewBase + dialogIndex, this);
  381.     LWindow*        aDialog = aDlgHandler.GetDialog();
  382.     MessageT        hitMessage;
  383.  
  384.     mCurrentDialog = aDialog;
  385.     mCurrentDialogIndex = dialogIndex;
  386.     
  387.     this->SetupExampleDialog(dialogIndex, aDialog);
  388.     
  389.     aDialog->Show();
  390.     
  391.     do
  392.         {
  393.  
  394.         hitMessage = aDlgHandler.DoDialog();
  395.  
  396.         } while ((hitMessage != msg_OK) && (hitMessage != msg_Cancel));
  397.  
  398.     this->CleanupExampleDialog(dialogIndex, aDialog);
  399.     }
  400.  
  401. void MyApplication::SetupExampleDialog(UInt32 dialogIndex, LWindow* itsWindow)
  402.     {
  403.     // Set up one of our test dialogs, just prior to showing it.
  404.  
  405.     LPane*        aPane;
  406.     LControl*    aBroadcaster = (LControl*) itsWindow->FindPaneByID('ENAB');
  407.     if (aBroadcaster != NULL)    // not all of our commands have this checkbox!
  408.         aBroadcaster->AddListener(this);
  409.  
  410.     switch (dialogIndex)
  411.         {
  412.         case kPushButtonDlgIndex:
  413.  
  414.             aPane = itsWindow->FindPaneByID('DFLT');
  415.             ((AGAPushButtonPP*) aPane)->mAGAObject->SetDefault(AGAObject::kIsDefault, AGAObject::kFrameOutside);
  416.  
  417.             break;
  418.  
  419.         case kCheckBoxDlgIndex:
  420.  
  421.             aPane = itsWindow->FindPaneByID('CBX3');
  422.             ((LStdCheckBox*) aPane)->SetValue(AGACheckBox::kCheckBoxMixed);
  423.  
  424.             break;
  425.  
  426.         case kRadioButtonDlgIndex:
  427.  
  428.             aPane = itsWindow->FindPaneByID('BTN3');
  429.             ((LStdRadioButton*) aPane)->SetValue(AGARadioButton::kRadioButtonMixed);
  430.  
  431.             break;
  432.  
  433.         case kScrollBarDlgIndex:
  434.  
  435.             ((LControl*) itsWindow->FindPaneByID('LIVE'))->AddListener(this);
  436.             ((LControl*) itsWindow->FindPaneByID('PROP'))->AddListener(this);
  437.  
  438.             aPane = itsWindow->FindPaneByID('SBAR');
  439.             ((LControl*) aPane)->AddListener(this);
  440.             ((AGAScrollBarPP*) aPane)->mAGAObject->SetPageSize(25, AGAObject::kDontRedraw);
  441.             ((AGAScrollBarPP*) aPane)->mAGAObject->SetStepSizes(1, 25);
  442.  
  443.             break;
  444.  
  445.         case kSliderDlgIndex:
  446.             {
  447.             AGASliderPP*    aSlider;
  448.  
  449.             ThrowIfNil_(aSlider = (AGASliderPP*) itsWindow->FindPaneByID('VSPL'));
  450.             aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
  451.  
  452.             ThrowIfNil_(aSlider = (AGASliderPP*) itsWindow->FindPaneByID('VSRC'));
  453.             aSlider->mAGAObject->SetPageSize(20, AGAObject::kDontRedraw);
  454.  
  455.             ThrowIfNil_(aSlider = (AGASliderPP*) itsWindow->FindPaneByID('VSPR'));
  456.             aSlider->mAGAObject->SetJustification(teFlushRight);
  457.             aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
  458.  
  459.             ThrowIfNil_(aSlider = (AGASliderPP*) itsWindow->FindPaneByID('HSPL'));
  460.             aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
  461.  
  462.             ThrowIfNil_(aSlider = (AGASliderPP*) itsWindow->FindPaneByID('HSRC'));
  463.             aSlider->mAGAObject->SetPageSize(20, AGAObject::kDontRedraw);
  464.  
  465.             ThrowIfNil_(aSlider = (AGASliderPP*) itsWindow->FindPaneByID('HSPR'));
  466.             aSlider->mAGAObject->SetJustification(teFlushRight);
  467.             aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
  468.             aSlider->SetMaxValue(32);
  469.  
  470.             aBroadcaster = (LControl*) itsWindow->FindPaneByID('LVSL');
  471.             aBroadcaster->AddListener(this);
  472.  
  473.             aBroadcaster = (LControl*) itsWindow->FindPaneByID('PRSL');
  474.             aBroadcaster->AddListener(this);
  475.             }
  476.             break;
  477.  
  478.         case kProgressDlgIndex:
  479.             {
  480.             ((LControl*) itsWindow->FindPaneByID('GO_1'))->AddListener(this);
  481.             ((LControl*) itsWindow->FindPaneByID('GO_2'))->AddListener(this);
  482.             ((LControl*) itsWindow->FindPaneByID('STP1'))->AddListener(this);
  483.             ((LControl*) itsWindow->FindPaneByID('STP2'))->AddListener(this);
  484.             ((LControl*) itsWindow->FindPaneByID('SETV'))->AddListener(this);
  485.             ((LControl*) itsWindow->FindPaneByID('CORG'))->AddListener(this);
  486.             }
  487.             break;
  488.  
  489.         case kFolderTabsDlgIndex:
  490.  
  491.             aBroadcaster = (LControl*) itsWindow->FindPaneByID('TPO1');
  492.             aBroadcaster->AddListener(this);
  493.  
  494.             aBroadcaster = (LControl*) itsWindow->FindPaneByID('TPO2');
  495.             aBroadcaster->AddListener(this);
  496.  
  497.             aBroadcaster = (LControl*) itsWindow->FindPaneByID('TPO3');
  498.             aBroadcaster->AddListener(this);
  499.  
  500.             break;
  501.  
  502.         }
  503.     }
  504.  
  505. void MyApplication::CleanupExampleDialog(UInt32 dialogIndex, LWindow* itsWindow)
  506.     {
  507.     // Clean up one of our dialogs that is being closed.
  508.  
  509.     switch (dialogIndex)
  510.         {
  511.         case kProgressDlgIndex:
  512.             {
  513.             // Null the pointers so we don't go haywire at next idle !
  514.  
  515.             mProgressIndicator1 = NULL;
  516.             mProgressIndicator2 = NULL;
  517.             mMovingProgressOrigin = FALSE;
  518.             mSkipNext = FALSE;
  519.             }
  520.             break;
  521.         }
  522.     }
  523.  
  524. static void EnablePane(LPane* aPane, Boolean enable)
  525.     {
  526.     ThrowIfNil_(aPane);
  527.  
  528.     if (enable)
  529.         aPane->Enable();
  530.     else
  531.         aPane->Disable();
  532.     }
  533.  
  534. void MyApplication::EnableDisableDialog(UInt32 dialogIndex, LWindow* itsWindow, Boolean enable)
  535.     {
  536.     // There is an 'ENAB' check box in many of our dialogs,
  537.     // that enables/disables bunches o' items in the dialogs.
  538.  
  539.     LPane*    aPane;
  540.  
  541.     switch (dialogIndex)
  542.         {
  543.         case kPushButtonDlgIndex:
  544.  
  545.             EnablePane(itsWindow->FindPaneByID('NORM'), enable);
  546.             EnablePane(itsWindow->FindPaneByID('DFLT'), enable);
  547.             EnablePane(itsWindow->FindPaneByID('ICN1'), enable);
  548.             EnablePane(itsWindow->FindPaneByID('ICN2'), enable);
  549.             EnablePane(itsWindow->FindPaneByID('ICN3'), enable);
  550.  
  551.             break;
  552.  
  553.         case kCheckBoxDlgIndex:
  554.  
  555.             EnablePane(itsWindow->FindPaneByID('ICN1'), enable);
  556.             EnablePane(itsWindow->FindPaneByID('ICN2'), enable);
  557.             EnablePane(itsWindow->FindPaneByID('ICN3'), enable);
  558.             EnablePane(itsWindow->FindPaneByID('CBX1'), enable);
  559.             EnablePane(itsWindow->FindPaneByID('CBX2'), enable);
  560.             EnablePane(itsWindow->FindPaneByID('CBX3'), enable);
  561.  
  562.             break;
  563.  
  564.         case kRadioButtonDlgIndex:
  565.  
  566.             EnablePane(itsWindow->FindPaneByID('BTN1'), enable);
  567.             EnablePane(itsWindow->FindPaneByID('BTN2'), enable);
  568.             EnablePane(itsWindow->FindPaneByID('BTN3'), enable);
  569.             EnablePane(itsWindow->FindPaneByID('ICN1'), enable);
  570.             EnablePane(itsWindow->FindPaneByID('ICN2'), enable);
  571.             EnablePane(itsWindow->FindPaneByID('ICN3'), enable);
  572.             EnablePane(itsWindow->FindPaneByID('ICN4'), enable);
  573.             EnablePane(itsWindow->FindPaneByID('ICN5'), enable);
  574.             EnablePane(itsWindow->FindPaneByID('ICN6'), enable);
  575.             EnablePane(itsWindow->FindPaneByID('ICN7'), enable);
  576.  
  577.             break;
  578.  
  579.         case kSliderDlgIndex:
  580.  
  581.             EnablePane(itsWindow->FindPaneByID('VSPL'), enable);
  582.             EnablePane(itsWindow->FindPaneByID('VSRC'), enable);
  583.             EnablePane(itsWindow->FindPaneByID('VSPR'), enable);
  584.             EnablePane(itsWindow->FindPaneByID('HSPL'), enable);
  585.             EnablePane(itsWindow->FindPaneByID('HSRC'), enable);
  586.             EnablePane(itsWindow->FindPaneByID('HSPR'), enable);
  587.  
  588.             break;
  589.  
  590.         case kScrollBarDlgIndex:
  591.  
  592.             EnablePane(itsWindow->FindPaneByID('SBAR'), enable);
  593.             EnablePane(itsWindow->FindPaneByID(PaneIDT_HorizontalScrollBar), enable);
  594.             EnablePane(itsWindow->FindPaneByID(PaneIDT_VerticalScrollBar), enable);
  595.  
  596.             break;
  597.  
  598.         case kPopupMenuDlgIndex:
  599.  
  600.             EnablePane(itsWindow->FindPaneByID('POP1'), enable);
  601.             EnablePane(itsWindow->FindPaneByID('POP2'), enable);
  602.             EnablePane(itsWindow->FindPaneByID('POP3'), enable);
  603.  
  604.             break;
  605.  
  606.         case kEditTextDlgIndex:
  607.  
  608.             EnablePane(itsWindow->FindPaneByID('EDT1'), enable);
  609.             itsWindow->FindPaneByID('EDT1')->Refresh();    // std enable/disable does not let attachments redraw!!! ick!
  610.  
  611.             break;
  612.  
  613.         case kGroupBoxDlgIndex:
  614.         
  615.             EnablePane(itsWindow->FindPaneByID('GRP1'), enable);
  616.                 EnablePane(itsWindow->FindPaneByID('GR1A'), enable);
  617.                     EnablePane(itsWindow->FindPaneByID('R1A1'), enable);
  618.                     EnablePane(itsWindow->FindPaneByID('R1A2'), enable);
  619.                 EnablePane(itsWindow->FindPaneByID('GR1B'), enable);
  620.                     EnablePane(itsWindow->FindPaneByID('R1B1'), enable);
  621.                     EnablePane(itsWindow->FindPaneByID('R1B2'), enable);
  622.  
  623.             EnablePane(itsWindow->FindPaneByID('GRP2'), enable);
  624.                 EnablePane(itsWindow->FindPaneByID('GR2A'), enable);
  625.                     EnablePane(itsWindow->FindPaneByID('R2A1'), enable);
  626.                     EnablePane(itsWindow->FindPaneByID('R2A2'), enable);
  627.                 EnablePane(itsWindow->FindPaneByID('GR2B'), enable);
  628.                     EnablePane(itsWindow->FindPaneByID('R2B1'), enable);
  629.                     EnablePane(itsWindow->FindPaneByID('R2B2'), enable);
  630.  
  631.             EnablePane(itsWindow->FindPaneByID('GRP3'), enable);
  632.                 EnablePane(itsWindow->FindPaneByID('GR3A'), enable);
  633.                     EnablePane(itsWindow->FindPaneByID('R3A1'), enable);
  634.                     EnablePane(itsWindow->FindPaneByID('R3A2'), enable);
  635.                 EnablePane(itsWindow->FindPaneByID('GR3B'), enable);
  636.                     EnablePane(itsWindow->FindPaneByID('R3B1'), enable);
  637.                     EnablePane(itsWindow->FindPaneByID('R3B2'), enable);
  638.  
  639.             EnablePane(itsWindow->FindPaneByID('CBX1'), enable);
  640.             EnablePane(itsWindow->FindPaneByID('CBX2'), enable);
  641.             EnablePane(itsWindow->FindPaneByID('CBX3'), enable);
  642.  
  643.             break;
  644.  
  645.         }
  646.     }
  647.  
  648.